package arthur.dy.lee;

import com.taobao.tair.json.JSONObject;
import io.netty.util.HashedWheelTimer;
import io.netty.util.Timeout;
import io.netty.util.Timer;
import io.netty.util.TimerTask;
import org.redisson.misc.BiHashMap;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;

/**
 * Created by wb-lidongyue on 2017/8/21.
 */
public class Test {
    public static final BiHashMap<String, String> map = new BiHashMap<>();
    static {
        map.put("1", "a");
        map.put("2,", "b");
        map.makeImmutable();
    }

    public static BiHashMap<String, String> getMap() {
        return map;
    }

    public static void main(String[] args) {

        Map<String, String> map = new HashMap<>();
        map.put("1", "a");
        map.put("2,", "b");
        map = Collections.unmodifiableMap(map);

        System.out.println(JSONObject.toJSONString(map));
//        System.out.println(Test.getMap().size());
//
        final Timer timer = new HashedWheelTimer();
        timer.newTimeout(new TimerTask() {
            public void run(Timeout timeout) throws Exception {
                System.out.println("timeout 5");
            }
        }, 5, TimeUnit.SECONDS);
        timer.newTimeout(new TimerTask() {
            public void run(Timeout timeout) throws Exception {
                System.out.println("timeout 10");
            }
        }, 10, TimeUnit.SECONDS);


    }
}
